package file;

import java.io.File;

public class ListFilesDemo {
    public static void main(String[] args) {
        File file = new File(".");
        if(file.isDirectory()){
            File[] files = file.listFiles();
            System.out.println("共有:"+files.length+"个子项");
            for (File file1 : files) {
                System.out.println(file1.getName());
            }
        }else {
            System.out.println("不是目录,或目录不存在！");
        }


    }
}
